<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>邮件消息详细</title>
<script language="javascript">
	function replyMessage(){

		var replyinfo=$("#replyinfo").val();
		var MessageID=$("#MessageID").val();
		var shopid=$("#shopid").val();
		if(replyinfo.indexOf("&")>-1){
			alert('回复内容不能有特殊字符“&”，请调整后再提交吧！');
			return false;
		}
		$("#replybtn").html("已提交，正在处理..");
		$("#replybtn").val("已提交，正在处理..");
		$("#replybtn").attr("disabled",'true');
		$.post("/ebayMessage/ajaxbutton", {"op": "replyMessage",'replyinfo':replyinfo,
		'MessageID':MessageID,'shop_id':shopid},function(data){														
			if(data.insert_state){
				$("#nonetag").hide();
				$("#replylist").html($("#replylist").html()+'<div><font color="#ccc">'+
				data.witer+'('+data.witerid+')&nbsp;&nbsp;'+data.create_time+'</font><br><pre style="font-family:Arial, Helvetica;color:#000000;">'+data.replyinfo+'</pre></div>');
				var agent_str='';
				if(data.agent_visit==1){
					agent_str='当前店铺为远程获取与回复数据，'
				
				}
				if(data.up_online_ret.state=='success'){
					if(data.up_online_ret.msg=='Recipient User Id is invalid.'){
						data.up_online_ret.msg+='(收件方不是一个有效的用户帐号)';
					}
					alert("回复成功，同步至线上成功!");		
				}else if(data.up_online_ret.state=='updateerror'){
					if(data.up_online_ret.msg=='Recipient User Id is invalid.'){
						data.up_online_ret.msg+='(收件方不是一个有效的用户帐号)';
					}
					alert("回复成功，但同步至线上失败!失败原因："+data.up_online_ret.msg);	
				}else{
					var repmsg='';
					if(data.up_online_ret.replyurl){
						 repmsg='你也可以请求'+ data.up_online_ret.replyurl+' 此地址将回复马上发送给客户';
					}
					alert("回复成功，"+agent_str+"我们稍后将同步至线上!");	
				}
				$("#replyinfo").val('');
			}else{
				alert('回复失败, 未知错误');
			}
			$("#replybtn").attr("disabled",false);
			$("#replybtn").html("好了，提交回复消息");
		},'json')
	}
	
	function setMsgFlag(msgid){
		var msg_flag=$("#msg_flag").val();
		var msgid=msgid;
		$.post("/ebayMessage/ajaxbutton", {"op": "setMsgFlag",'msg_flag':msg_flag,"msgid":msgid},function(data){														
			if(data.state=='success'){
				alert('设置成功');
			}
		},'json')
	}
</script>
<body class="withvernav">
<div class="bodywrapper"> {{include file='/public/leftmenu.tpl'}}
  <div class="centercontent">
    <div class="pageheader notab">
      <h1 class="pagetitle">消息详细</h1>
      <span class="pagedesc"></span>
      <div class="menulist">
        <ul class="profile_summary">
         
        </ul>
      </div>
    </div>
    <!--pageheader-->
    
    <div id="contentwrapper" class="contentwrapper">
      <div id="basicform" class="subcontent">
        <input type="hidden" name="shopid" id="shopid" value="{{$detail.shop_id}}">
        <input type="hidden" name="MessageID" id="MessageID" value="{{$detail.MessageID}}">
          <table cellpadding="0" cellspacing="0" border="0" class="stdtable">
            <thead>
              <tr>
                <th class="head1">
                    <strong style="float:left;">消息详细</strong>
                    <span style="float:right;padding-right:20px;">将该邮件设置为
                    <select id="msg_flag" name="msg_flag" class="small_input" style="width:100px;">
									 <option value="0">-取消状态-</option>
                                     	 <option value="1" {{if $detail.msg_flag=='1'}} selected{{/if}}>Case已回复</option>
                                         <option value="3" {{if $detail.msg_flag=='3'}} selected{{/if}}>违规警告</option>
                                         <option value="2" {{if $detail.msg_flag=='2'}} selected{{/if}}>重复邮件</option>
                                         <option value="4" {{if $detail.msg_flag=='4'}} selected{{/if}}>无需回复</option>
								   </select> <input type="button" value="设置" onClick="setMsgFlag({{$detail.id}})" name="setbtn">
                                   &nbsp; <button type="button" onClick="javascript:window.close();" class="btn btn-primary" >关闭当前页</button></span></th>
              </tr>
            </thead>
          </table>
          <table cellpadding="0" cellspacing="0" border="0" class="stdtable">
           <tbody>
             
               <tr>
                <td width="120" align="right" bgcolor="#FFFFFF" class="head1"><strong>发件人：</strong></td>
                <td class="head0" bgcolor="#FFFFFF">{{$detail.Sender}}</td>
                <td align="right" bgcolor="#FFFFFF" class="head0" style="width:80px"><strong>状态：</strong></td>
                <td bgcolor="#FFFFFF">{{if $detail.Replied eq 1}}已回复{{else}}未回复{{/if}}</td>
                <td align="right"  bgcolor="#FFFFFF" class="head0" style="width:80px;"><strong>接收时间：  </strong></td>
                <td  bgcolor="#FFFFFF">{{$detail.ReceiveDate}}</td>
                <td  bgcolor="#FFFFFF" width="80"><strong>消息类型：</strong></td>
                <td  bgcolor="#FFFFFF">{{$detail.MessageType}}</td>
              </tr>
               <tr>
                <td align="right" bgcolor="#FFFFFF" class="head1"><dl class="STYLE1">
                  <strong>                店铺：   </strong></td>
                <td class="head0" bgcolor="#FFFFFF">{{$detail.SendToName}}</td>
                <td align="right" bgcolor="#FFFFFF" class="head0"><strong>商品编号：</strong></td>
                <td class="head0" bgcolor="#FFFFFF">{{$detail.itemID}}</td>
                <td align="right" bgcolor="#FFFFFF" class="head0"><strong>关联订单：</strong></td>
                <td  bgcolor="#FFFFFF">&nbsp;</td>
                <td  bgcolor="#FFFFFF">&nbsp;</td>
                <td  bgcolor="#FFFFFF">&nbsp;</td>
              </tr>
              
                <tr>
                  <td align="right" bgcolor="#FFFFFF" class="head1"><strong>主题：</strong></td>
                  <td class="head0" colspan="7" bgcolor="#FFFFFF">{{$detail.Subject}}</td>
                </tr>
                <tr>
                  <td align="right" bgcolor="#FFFFFF" class="head1"><strong>消息内容：</strong></td>
                  <td class="head0" colspan="7" bgcolor="#FFFFFF"><iframe width="100%" scrolling="yes" height="360" frameborder="0" border="0" name="orderhistory" id="orderhistory" src="/ebayMessage/ajaxbutton?op=messageText&MessageID={{$detail.MessageID}}"></iframe></td>
                </tr>
                <tr>
                  <td align="right" bgcolor="#FFFFFF" class="head1"><strong>历史回复：</strong></td>
                  <td class="head0" colspan="7" bgcolor="#FFFFFF"><div style="border: 1px solid #aaaaaa;text-align:left; font-size:14px;padding:5px;" id="replylist">
                  {{foreach from=$replylist item=res key=key}}
                      <div style="font-family:Arial, Helvetica;color:#000000;width:700px;word-wrap:break-word;">
                      <font color="#ccc">{{$res.witer}}({{$res.witerid}})&nbsp;&nbsp;{{$res.create_time}}</font>
                      <br>{{$res.replyinfo}}</div>
                  {{/foreach}}
                    {{if $replylist eq null}}
                    	<div id="nonetag">&nbsp;&nbsp;</div>
                    {{/if}}
                  </div></td>
                </tr>
                <tr>
                <td align="right" bgcolor="#FFFFFF" class="head1"><strong>回复消息：</strong></td>
                <td colspan="7" valign="middle" bgcolor="#FFFFFF" class="head0"><textarea style="font-size:14px;width:622px;height:80px;margin-bottom:-8px;word-break:keep-all;" id="replyinfo" name="replyinfo">{{$detail.replyinfo}}</textarea>
                 <button type="button" id="replybtn" onClick="javascript:replyMessage();" class="btn btn-primary" >好了，提交回复消息</button></td>
              </tr>
             </tbody>
           </table>
<br>
            <table cellpadding="0" cellspacing="0" border="0" class="stdtable">
            <thead>
              <tr>
                <td align="center" style="text-align:center;">
                 <button type="button" onClick="javascript:window.close();" class="btn btn-primary" >关闭当前页</button>
                 </td>
              </tr>
            
            </thead>
           
          </table>
          <br>
<table cellpadding="0" cellspacing="0" border="0" class="stdtable" style="table-layout: fixed;">
<thead>
  <tr class="lbbt">
    <td width="10%" bgcolor="#FEFFF1" class="head1">相关订单编号</td>
    <td width="5%" bgcolor="#FEFFF1" class="head1">状态\订单属性</td>
    <td width="3%" bgcolor="#FEFFF1" class="head1">延迟</td>
    <td width="10%"  bgcolor="#FEFFF1" class="head1">店铺/客户/负责人</td>
    <td width="10%" bgcolor="#FEFFF1" class="head1">原金额/订单金额/总价</td>
    <td width="7%" bgcolor="#FEFFF1" class="head1">国家/国家(英)</td>
    <!--  <td bgcolor="#FEFFF1" style="width: 50px;">发货仓库</td>-->
    <td  bgcolor="#FEFFF1" class="head1">发货仓库/货运方式/货运单号</td>
    <td  bgcolor="#FEFFF1" class="head1" >订单日期/导入日期</td>
    <td  bgcolor="#FEFFF1" class="head1" >运费/交易号</td>
	<td  bgcolor="#FEFFF1" class="head1" >客户邮箱/Paypal邮箱</td>
  </tr>
</thead>
<tbody >
{{foreach from=$orderlist item=li key=key}}
  <tr onDblClick="showOrderlistSell({{$li.order_id}},'{{$li.order_sn}}','{{$li.tradeid}}')" title="双击显示商品信息" style="cursor:pointer">
    <td valign="middle" style="position:relative;">
     <a href="/orderlist/editorder?order_id={{$li.order_id}}" target="_blank"><font color="#6666FF">{{$li.order_sn}}</font></a>
     <br>
      {{if $li.is_nodelivery==0}}
      <img title="可发货" src="/fuman/images/icons/g_cross_circle.png" alt="" width="16" height="16">
      {{/if}}
      {{if $li.is_nodelivery==1}}
      <img title="禁止发货" src="/fuman/images/icons/cross_circle.png" alt="" width="16" height="16">
     {{/if}}
      {{if $li.is_que==1}} 
      <img title="缺货" src="/fuman/images/icons/alertflag.png" alt="">
      {{/if}}
      {{if $li.is_que==2}} 
      <img title="不缺货" src="/fuman/images/icons/g_alertflag.png" alt="">
      {{/if}}
   	{{if $li.is_overweight==1}}
    <img title="超重" src="/fuman/images/icons/orderweight.png" alt="">
    {{/if}}
   {{if $li.is_overweight==2}}
   <img title="不超重" src="/fuman/images/icons/g_orderweight.png" alt="">
   {{/if}}
   
   
    <img src="/fuman/images/icons/g_mail.png" title="无买家Message信息" border="0"> 
    
    
    {{if $li.platform_message}}
    <img  src="/fuman/images/icons/ebaynote.png" title="{{$li.platform_message}}"> 
    {{else}}
    <img title="无平台留言" src="/fuman/images/icons/g_ebaynote.png" alt=""> 
    {{/if}}

    {{if $li.remark}}
    <img src="/fuman/images/icons/content.png" title="{{$li.remark}}">
    {{else}}
    <img title="无备注" src="/fuman/images/icons/g_content.png" alt="">
    {{/if}}     </td>
    <td valign="middle"><img src="/fuman/images/icons/flag_{{$li.order_status}}.gif">{{$li.statustext}}<br>{{$li.order_source}}</td>
     <td valign="middle">{{$li.numday}}天</td>
    <td style="position:relative;">
   
      <div style="margin-left:2px;">{{$li.shopname}} ({{$li.shopoper}})
     <br>{{$li.customerid}}    </div>
     
      <div class="lbcp">      </div>   </td>
    <td valign="middle">{{$li.moneytype}} {{$li.goods_originask}}<br>RMB {{$li.goods_amount}}<br>RMB {{$li.goods_total}} </td>
    <td valign="middle">{{$li.country}}<br>{{$li.country_cn}}</td>
    <td class="cz">
        {{if $li.shipping_status==0}}
        未分仓
        {{/if}}
        {{if $li.shipping_status==1}}
        英华英国仓
        {{/if}}
        {{if $li.shipping_status==2}}
        英华德国仓
        {{/if}}
        {{if $li.shipping_status==3}}
        美国仓
        {{/if}}
        {{if $li.shipping_status==4}}
        万邑通美西仓
        {{/if}}
        {{if $li.shipping_status==5}}
        一号仓
        {{/if}}
       <!-- <br/>{{$li.postageservice}}-->
        <br>{{$li.shipping_name}}<br>{{$li.shipping_number}}    </td>
    <td class="cz">{{$li.ordertime}}<br>{{$li.add_time}}</td>
   	<td class="cz">{{if $li.shipping_fee=='0.00'}}{{else}}<font color="#FF0000">{{$li.shipping_fee}}</font>{{/if}}<br>{{$li.tradeid}}</td>
    	<td class="cz">{{$li.email}}<br>{{$li.paypalmail}}</td>
  </tr>
 {{/foreach}}
  {{if $orderlist[0]['add_time'] eq ''}}
  	<tr><td colspan="10"> 没有关联到订单</td>
  {{/if}}
</tbody>
</table>
    </div>
    <!--contentwrapper--> 
  </div>
  <!-- centercontent --> 
</div>
<!--bodywrapper-->

</body>
</html>